package mysql

import (
	"gorm.io/gorm"
)

type House struct {
	gorm.Model
	address string  `gorm:"type:varchar(20);not null;comment:地址"`
	area    float64 `gorm:"type:float(10,2);not null;comment:面积"`
	rent    float64 `gorm:"type:float(10,2);not null;comment:租金"`
}

func (h *House) Release(houseId int) (house *House, err error) {
	err = db.Where("id = ?", houseId).Limit(1).Find(&house).Error
	return
}

func (h *House) ListHouse(houseId int) error {
	err = db.Where("house_id = ?", houseId).Limit(1).Find(&h).Error
	return err
}
